package homework03;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Flight {
    private String flightnumber;
    private LocalDateTime departureDatetime;
    private LocalDateTime arrivalDateTime;
    private String departureLocation;
    private String arrivalLocation;

    public Flight(String flightnumber, LocalDateTime departureDatetime, LocalDateTime arrivalDateTime, String departureLocation, String arrivalLocation) {
        this.flightnumber = flightnumber;
        this.departureDatetime = departureDatetime;
        this.arrivalDateTime = arrivalDateTime;
        this.departureLocation = departureLocation;
        this.arrivalLocation = arrivalLocation;
    }

    public void displayFlightInfo(){
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

        System.out.println("航班编号:" + flightnumber);
        System.out.println("起飞时间:"+departureDatetime.format(dateTimeFormatter));
        System.out.println("降落时间:"+arrivalDateTime.format(dateTimeFormatter));
        System.out.println("起飞地点:"+departureLocation);
        System.out.println("降落地点:"+arrivalLocation);
    }
}
